package com.shujia.wyh.day16;

/*
            把数组中的数据按照指定个格式拼接成一个字符串
            举例：int[] arr = {1,2,3};	输出结果：[1, 2, 3]
 */
public class StringTest4 {
    public static void main(String[] args) {
        int[] arr = {1,2,3};

        for(int i=0;i<arr.length;i++){
            if(i==0){
                System.out.print("["+arr[i]+",");
            }else if(i==arr.length-1){
                System.out.print(arr[i]+"]");
            }else {
                System.out.print(arr[i]+",");
            }
        }

    }
}
